package be.fgmodelsport.ourbeers.activity;

import java.util.Date;
import java.util.List;

import be.fgmodelsport.ourbeers.R;
import be.fgmodelsport.ourbeers.adapters.BeersAdapter;
import be.fgmodelsport.ourbeers.adapters.ConcatListViewAdapter;
import be.fgmodelsport.ourbeers.adapters.PersonalAdapter;
import be.fgmodelsport.ourbeers.database.DbBeerAdapter;
import be.fgmodelsport.ourbeers.objects.Beer;
import be.fgmodelsport.ourbeers.objects.Player;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

public class MainActivity extends Activity {
	private ConcatListViewAdapter mainListAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_layout);
		Player p = new Player("123", "ikke", 123, 123, 123, new Date("03/04/1987"));
		PersonalAdapter personalAdapter = new PersonalAdapter(p, this, R.layout.personal_information);
		List<Beer> beers = (new DbBeerAdapter()).getBeers();
		BeersAdapter beersAdapter = new BeersAdapter(this, android.R.layout.simple_list_item_1, beers);
		mainListAdapter = new ConcatListViewAdapter(personalAdapter, beersAdapter);
		
		ListView mainList = (ListView)findViewById(R.id.mainlist);
		mainList.setAdapter(mainListAdapter);
	}
}
